home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ETO Development Tools 4
/
ETO Development Tools 4.iso
/
Tools - Objects
/
MacApp
/
MacApp 2.0.1
/
MacApp CD Release
/
MacApp 2.0.1 (Hard Disk Ready)
/
Libraries
/
UMacApp.TCommand.p
< prev
next >
Wrap
Text File
|
1990-10-25
|
6KB
|
215 lines
{$P}
{[a-,body+,h-,o=100,r+,rec+,t=4,u+,#+,j=20/57/1$,n-]}
{ UMacApp.TCommand.p }
{ Copyright © 1985-1990 by Apple Computer, Inc. All rights reserved. }
{--------------------------------------------------------------------------------------------------}
{$S MACommandRes}
PROCEDURE TCommand.ICommand(itsCmdNumber: CmdNumber;
itsDocument: TDocument;
itsView: TView;
itsScroller: TScroller);
BEGIN
IObject;
fCmdNumber := itsCmdNumber;
fChangedDocument := itsDocument;
fCmdDone := FALSE;
fCanUndo := TRUE;
fCausesChange := TRUE;
fChangesClipboard := FALSE;
fFreeOnCompletion := TRUE; { command will be freed after DoIt or Commit
}
fRecurring := FALSE; { Command is a one-shot deal }
fPriority := kPriorityNormal; { Don't worry, be happy! }
fReadyToExecute := TRUE; { Always executable by default }
fTracksMouse := FALSE; { Set to true by
TApplication.HandleMouseDown for
compatibility (2.0) }
fInitialPt := gZeroPt; { Best initial value }
fConstrainsMouse := FALSE;
fViewConstrain := TRUE;
fTrackNonMovement := FALSE;
fView := itsView;
fScroller := itsScroller;
END;
{--------------------------------------------------------------------------------------------------}
{$S MADoCommand}
PROCEDURE TCommand.AutoScroll(deltaH, deltaV: VCoordinate);
BEGIN
IF fScroller <> NIL THEN
fScroller.ScrollBy(deltaH, deltaV, kRedraw)
ELSE
BEGIN
{??? any sensible behaviour here? }
END;
END;
{--------------------------------------------------------------------------------------------------}
{$S MADoCommand}
PROCEDURE TCommand.Commit;
BEGIN
END;
{--------------------------------------------------------------------------------------------------}
{$S MADoCommand}
PROCEDURE TCommand.DoIt;
BEGIN
END;
{--------------------------------------------------------------------------------------------------}
{$S MADoCommand}
FUNCTION TCommand.IsDoneTracking: BOOLEAN;
BEGIN
IF fView <> NIL THEN
IsDoneTracking := fView.IsDoneTracking
ELSE
{??? Would it be better to let the application have a crack at it here?}
IsDoneTracking := NOT StillDown;
END;
{--------------------------------------------------------------------------------------------------}
{$S MACommandRes}
FUNCTION TCommand.IsReadyToExecute: BOOLEAN;
BEGIN
IsReadyToExecute := fReadyToExecute;
END;
{--------------------------------------------------------------------------------------------------}
{$S MADoCommand}
PROCEDURE TCommand.RedoIt;
BEGIN
END;
{--------------------------------------------------------------------------------------------------}
{$S MADoCommand}
PROCEDURE TCommand.TrackConstrain(anchorPoint, previousPoint: VPoint;
VAR nextPoint: VPoint);
BEGIN
IF fView <> NIL THEN
fView.TrackConstrain(anchorPoint, previousPoint, nextPoint)
ELSE
BEGIN
{??? should this call back into an application method if there is no view? }
END;
END;
{--------------------------------------------------------------------------------------------------}
{$S MADoCommand}
PROCEDURE TCommand.TrackFeedback(anchorPoint, nextPoint: VPoint;
turnItOn, mouseDidMove: BOOLEAN);
BEGIN
IF fView <> NIL THEN
fView.TrackFeedback(anchorPoint, nextPoint, turnItOn, mouseDidMove)
ELSE
BEGIN
{??? should this call back into an application method if there is no view? }
END;
END;
{--------------------------------------------------------------------------------------------------}
{$S MADoCommand}
FUNCTION TCommand.TrackMouse(aTrackPhase: TrackPhase;
VAR anchorPoint, previousPoint, nextPoint: VPoint;
mouseDidMove: BOOLEAN): TCommand;
BEGIN
IF fView <> NIL THEN
fView.TrackMouse(aTrackPhase, anchorPoint, previousPoint, nextPoint, mouseDidMove)
ELSE
BEGIN
{??? should this call back into an application method if there is no view? }
END;
IF (aTrackPhase = trackRelease) & ((fView = NIL) | (NOT fView.ContainsMouse(nextPoint))) THEN
TrackMouse := NIL
ELSE
TrackMouse := SELF;
END;
{--------------------------------------------------------------------------------------------------}
{$S MADoCommand}
PROCEDURE TCommand.UndoIt;
BEGIN
END;
{--------------------------------------------------------------------------------------------------}
{$S MAFields}
PROCEDURE TCommand.Fields(PROCEDURE DoToField(fieldName: Str255;
fieldAddr: Ptr;
fieldType: INTEGER)); OVERRIDE;
BEGIN
DoToField('TCommand', NIL, bClass);
DoToField('fCanUndo', @fCanUndo, bBoolean);
DoToField('fCausesChange', @fCausesChange, bBoolean);
DoToField('fChangedDocument', @fChangedDocument, bObject);
DoToField('fChangesClipboard', @fChangesClipboard, bBoolean);
DoToField('fCmdDone', @fCmdDone, bBoolean);
DoToField('fCmdNumber', @fCmdNumber, bCmdNumber);
DoToField('fConstrainsMouse', @fConstrainsMouse, bBoolean);
DoToField('fFreeOnCompletion', @fFreeOnCompletion, bBoolean);
DoToField('fInitialPt', @fInitialPt, bPoint);
DoToField('fPriority', @fPriority, bByte);
DoToField('fReadyToExecute', @fReadyToExecute, bBoolean);
DoToField('fRecurring', @fRecurring, bBoolean);
DoToField('fScroller', @fScroller, bObject);
DoToField('fTrackNonMovement', @fTrackNonMovement, bBoolean);
DoToField('fTracksMouse', @fTracksMouse, bBoolean);
DoToField('fView', @fView, bObject);
DoToField('fViewConstrain', @fViewConstrain, bBoolean);
INHERITED Fields(DoToField);
END;
{--------------------------------------------------------------------------------------------------}
{$S MACommandRes}
PROCEDURE TNoChangesCommand.INoChangesCommand(itsCmdNumber: CmdNumber;
itsDocument: TDocument;
itsView: TView;
itsScroller: TScroller);
BEGIN
ICommand(itsCmdNumber, itsDocument, itsView, itsScroller);
{ we said NO changes }
fCanUndo := FALSE;
fCausesChange := FALSE;
END;
{--------------------------------------------------------------------------------------------------}
{$S MAFields}
PROCEDURE TNoChangesCommand.Fields(PROCEDURE DoToField(fieldName: Str255;
fieldAddr: Ptr;
fieldType: INTEGER)); OVERRIDE;
BEGIN
DoToField('TNoChangesCommand', NIL, bClass);
INHERITED Fields(DoToField);
END;